init_sys:
	cli				; Clear interrupts
	mov ax, 0
	mov ss, ax			; Set stack segment and pointer
	mov sp, 0FFFFh
	sti				; Restore interrupts

	cld				; The default direction for string operations
					; will be 'up' - incrementing address in RAM

	mov ax,2000h			; Set all segments to match where kernel is loaded
	mov ds, ax			; After this, we don't need to bother with
	mov es, ax			; segments ever again, as MikeOS and its programs
	mov fs, ax			; live entirely in 64K
	mov gs,ax
	
	;  
	;mov ax, 0x1000 ; Now we set up the space for the extended Kernel at 0x1000
	;mov gs, ax ; GS=0x1000
	; Now we check for the disk stuff
	cmp dl, 0 ; If the disk has changed a bit then we need to get the drive params.....
	je no_change
	mov [bootdev], dl		; Save boot device number
	push es 
	mov ah, 8			; Get drive parameters
	int 13h
	pop es
	and cx, 3Fh			; Maximum sector number
	mov [SecsPerTrack], cx		; Sector numbers start at 1
	movzx dx, dh			; Maximum head number
	add dx, 1			; Head numbers start at 0 - add 1 for total
	mov [Sides], dx
	mov ah,0x0
	mov al,0x2
	int 0x10
	mov ax,0x1003
	mov bx,0
	int 0x10
	
	call os_clear_screen